﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Ingebet.Model.Domain;
using Ingebet.Repository.Contract;
using NHibernate;
using NHibernate.Criterion;

namespace Ingebet.Repository
{
    public class CompetitionRepository : Repository<Competition, int>, ICompetitionRepository
    {
        public Competition GetByName(string compet)
        {
            ISession s = HelperSessionFactory.GetCurrentSession();
            var result = s.CreateCriteria(typeof(Competition))
                    .Add(Restrictions.Eq("Nom", compet))
                    .UniqueResult<Competition>();
            return result;
        }
    }
}